package com.fin.zw.intelligentbot.entity;

import com.fin.zw.intelligentbot.enums.IsEnd;
import com.fin.zw.intelligentbot.enums.NodeDir;
import lombok.Data;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(appliesTo = "verbal_node", comment = "话术节点信息")
@Data
public class VerbalNode extends BaseEntity {

    @Column(columnDefinition = "varchar(64) comment '话术id'")
    private String verbalId;

    @JoinColumn(name = "attitude_id", columnDefinition = "varchar(64) comment '客户分类id'")
    @ManyToOne(fetch = FetchType.EAGER)
    private CategoryLabel attitude;

    @Column(columnDefinition = "varchar(64) comment '父级节点id'")
    private String parentId;

    @Column(columnDefinition = "varchar(20) comment '类型'")
    @Enumerated(EnumType.STRING)
    private NodeDir flowSign;

    @Column(columnDefinition = "varchar(20) comment '是否结束'")
    @Enumerated(EnumType.STRING)
    private IsEnd isEnd;

    @Column(columnDefinition = "varchar(20) comment '是否打断'")
    @Enumerated(EnumType.STRING)
    private IsEnd needBreak;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "verbal_corpus", joinColumns = @JoinColumn(name = "verbal_node_id"), inverseJoinColumns = @JoinColumn(name = "corpus_id"))
    private Set<CorpusInfo> corpusInfoSet;

    @OneToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "company_id", columnDefinition = "varchar(64) COMMENT '企业id'")
    private Company company;
}
